enable to pass environment variables from outside#12
Open
joemphilips wants to merge 4 commits intodevjoes:masterfrom
Open
enable to pass environment variables from outside#12joemphilips wants to merge 4 commits intodevjoes:masterfrom
joemphilips wants to merge 4 commits intodevjoes:masterfrom
Conversation
ghost
reviewed
Jul 19, 2020
ghost
left a comment
There was a problem hiding this comment.
Thanks for contributing, I've added a few comments/questions.
| public DockerCompose(ILogger[] logger) | ||
| private readonly IEnumerable<KeyValuePair<string, object>> environmentVariables; | ||
|
|
||
| public DockerCompose(ILogger[] logger, IEnumerable<KeyValuePair<string, object>> environmentVariables) |
There was a problem hiding this comment.
Why is this an IEnumerable<KeyValuePair<,>> instead of a IDictionary<,>? If it is so that the order of the env vars can be preserved then does the order matter?
| /// </summary> | ||
| /// <param name="setupOptions">Options that control how docker-compose is executed.</param> | ||
| public void InitOnce(Func<IDockerFixtureOptions> setupOptions) | ||
| public async Task InitOnceAsync(Func<IDockerFixtureOptions> setupOptions) |
There was a problem hiding this comment.
Whilst I have no problem with this being async, just remember that as a fixture people will be calling this from a constructor (which are inherently synchronous). So they will have to do a .GetAwaiter().GetResult(). However if you are firing off multiple async Tasks then this would still make sense.
| /// <param name="setupOptions">Options that control how docker-compose is executed.</param> | ||
| /// <param name="dockerCompose"></param> | ||
| public void InitOnce(Func<IDockerFixtureOptions> setupOptions, IDockerCompose dockerCompose) | ||
| public async Task InitOnceAsync(Func<IDockerFixtureOptions> setupOptions, IDockerCompose dockerCompose) |
| public void Init(Func<IDockerFixtureOptions> setupOptions) | ||
| public async Task InitAsync(Func<IDockerFixtureOptions> setupOptions) | ||
| { | ||
| Init(setupOptions, null); |
| } | ||
| this.loggers.Log($"---- checking docker services ({i + 1}/{this.startupTimeoutSecs}) ----"); | ||
| Thread.Sleep(this.dockerCompose.PauseMs); | ||
| await Task.Delay(1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In my project, I wanted to parameterize
docker-composefile by environment variables.So that I can launch multiple instances of docker-compose and each binds to different ports and mounts on different path.
It's working fine in my project. So I will share here.